//package com.zq.order.config;
//
///**
// * @Author 张乔
// * @Date 2025/2/21 16:28
// */
//
//import jakarta.annotation.PostConstruct;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.amqp.core.ReturnedMessage;
//import org.springframework.amqp.rabbit.connection.CorrelationData;
//import org.springframework.amqp.rabbit.core.RabbitTemplate;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//@Configuration
//@Slf4j
//public class RabbitConfig implements RabbitTemplate.ConfirmCallback , RabbitTemplate.ReturnsCallback {
//
//
//
//    @Autowired
//    private RabbitTemplate rabbitTemplate;
//
//// PostConstruct在构造成功之后执行   初始化rabbitTemplate，并设置回调
//    @PostConstruct
//    public void init(){
//        rabbitTemplate.setConfirmCallback(this);
//        rabbitTemplate.setReturnsCallback(this);
//}
//
///*@Bean
//    public RabbitTemplate rabbitTemplate(){
//        RabbitTemplate rabbitTemplate = new RabbitTemplate();
//    rabbitTemplate.setConfirmCallback(this);
//    rabbitTemplate.setReturnsCallback(this);
//        return rabbitTemplate;
//}*/
//
//
//
//
//
//
////    消息发送确认回调
//    @Override
//    public void confirm(CorrelationData correlationData, boolean b, String s) {
//      log.info("correlationData:{},b:{},s:{}",correlationData,b,s);
//
//    }
//
////    消息发送失败回调
//    @Override
//    public void returnedMessage(ReturnedMessage returnedMessage) {
//log.info("returnedMessage:{}",returnedMessage);
//log.info("returnedMessage:{}",returnedMessage.getReplyCode());
//log.info("returnedMessage:{}",returnedMessage.getReplyText());
//log.info("returnedMessage:{}",returnedMessage.getExchange());
//log.info("returnedMessage:{}",returnedMessage.getRoutingKey());
//log.info("returnedMessage:{}",returnedMessage.getMessage());
//    }
//}
